{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>会员卡礼包管理</h2>
                                <a style="float: right" href="{:url('create')}"
                                   class="btn btn-success btn-sm">创建会员卡礼包</a>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">

                                    <div class="title_left">
                                        <form name="form"  method="get" action="">
                                            <div class="input-group" style="float: left;margin: 0 20px; position: relative;z-index: 10000">
                                                <input type="text" class="form-control" name="interval_timer"
                                                       id="interval_timer"
                                                       style="width: 200px;"
                                                       placeholder="请选择时间区间..." value="{:input('interval_timer')}">
                                            </div>
                                            <div class="col-md-2 col-sm-3 col-xs-3 form-group pull-left top_search">
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="title"
                                                           placeholder="输入搜下内容..." value="{:input('title')}">
                                                </div>

                                            </div>

                                            <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索</button>
                                        </form>
                                    </div>
                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                                <!--<input type="checkbox" class="checkall"-->
                                                       <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->
                                            <th width="30">一级科目</th>
                                            <!--<th width="30">一级科目</th>-->
                                            <!--<th width="">借贷方(绿色借方-灰色贷方)</th>-->
                                            <th>排序</th>
                                            <th width="30">ID</th>
                                            <th width="">礼包名称</th>
                                            <th width="">礼包价格</th>
                                            <th width="">激活时间(天)</th>
                                            <!--<th width="">分销比(%)</th>-->
                                            <th width="">次数</th>
                                            <th width="">添加(数)</th>
                                            <th width="">数量(剩余-总)</th>
                                            <th width="">销量</th>
                                            <th width="">前台销量</th>
                                            <!--<th width="">促销时间</th>-->
                                            <!--<th width="">使用期限</th>-->
                                            <th width="">创建时间</th>
                                            <th width="">审核状态</th>
                                            <th width="">一级审核</th>
                                            <th width="">二级审核</th>
                                            <th width="">三级审核</th>
                                            <th width="">排序</th>
                                            <th>是否启用</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="data"}
                                            <tr><td colspan="17"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        <form name="form" id="form" method="post" action="">
                                        {volist name="data" id="item"}
                                        <tr >
                                            <td >
                                                <input class="form-control" style="width: 70px;text-align: center"
                                                       type="text"  value="6001" readonly>
                                            </td>
                                            <!--<td >-->
                                                <!--<input class="form-control" style="width: 70px;text-align: center"-->
                                                       <!--type="text" name="code[{$item.id}]" value="{$item.code|default=''}">-->
                                            <!--</td>-->
                                            <!--<td>-->
                                                <!--<input type="checkbox" id="checkbox4_{$item.id}" class="chk_3"-->
                                                       <!--value="{$item.status}" {eq name="item['dc']" value="1"}checked{/eq} />-->
                                                <!--<label style="margin-left: 30px;margin-top: 5px;"-->
                                                       <!--onclick="CheckInfo('{:url(\'dc\',[\'id\' => $item[\'id\']])}')"-->
                                                       <!--for="checkbox4_{$item.id}"></label>-->
                                            <!--</td>-->
                                            <td width="30" align="center">
                                                <input class="form-control" style="width: 60px;text-align: center"
                                                       type="text" name="sort[]" value="{$item.sort}">
                                                <input type="hidden" name="orderId[]" value="{$item.id}">
                                            </td>
                                            <td>{$item.id}</td>

                                            <td>{$item.title}</td>
                                            <td>{$item.sale_price}</td>
                                            <td>{$item.jihuo_day}<br/>{:date('Y-m-d H:i:s',strtotime($item['create_time']) + $item['jihuo_day']*3600*24)}</td>
                                            <!--<td>{$item.per}%</td>-->
                                            <td>{$item.count}</td>
                                            <td>{$item.sycss}</td>
                                            <td>{$item.sycs}-{$item.zcs}</td>
                                            <td>{$item.sale_number}</td>
                                            <td width="30" align="center">
                                                <input class="form-control" style="width: 60px;text-align: center"
                                                       type="text" name="goods_sale[]" value="{$item.goods_sale}">
                                                <input type="hidden" name="orderId2[]" value="{$item.id}">
                                            </td>
                                            <!--<td>{:substr($item.start_time,0,10)}<br/>{:substr($item.end_time,0,10)}</td>-->
                                            <!--<td>{$item.day}天</td>-->
                                            <td>{:substr($item.create_time,0,101)}</td>
                                            <td>{$item.auding_text}</td>
                                            <td>{$item.auding_text1}</td>
                                            <td>{$item.auding_text2}</td>
                                            <td>{$item.auding_text3}</td>
                                            <td>{$item.sort}</td>
                                            <td>
                                                <input type="checkbox" id="checkbox4_{$item.id}" class="chk_3"
                                                       value="{$item.status}" {eq name="item['status']" value="1"}checked{/eq} />
                                                <label style="margin-left: 30px;margin-top: 5px;"
                                                       onclick="CheckInfo('{:url(\'status\',[\'id\' => $item[\'id\']])}')"
                                                       for="checkbox4_{$item.id}"></label>
                                            </td>

                                            <td class="operate" >
                                                <div>
                                                    <a style="margin-right:20px" href="{:url('Gift/shop_ticheng', ['id' => $item['id'],'title' => $item['title'],'type' => 1,'code' => $item['title']])}"
                                                       class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;门店礼包提成 {$item.mmff}
                                                    </a>
                                                    <a style="margin-right:20px" href="{:url('ShopGoods/salesman', ['id' => $item['id'],'title' => $item['title'],'type' => 3,'code' => $item['title']])}"
                                                       class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;业务员分销比
                                                    </a>


                                                    <a {notin name=":session('role_id')" value="11,12,13"}href="{:url('update', ['id' => $item['id']])}" {else/}onclick="layer.msg('审核员只有审核权限')"{/notin}
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;编 辑
                                                    </a>

                                                    {eq name="$auding_status" value="2"}
                                                    <a {notin name=":session('role_id')" value="11,12,13"}href="{:url('destroy', ['id' => $item['id']])}" onClick="return confirm('确定删除吗?')" {else/}onclick="layer.msg('审核员只有审核权限')"{/notin}
                                                       class="label label-danger"

                                                    >
                                                        <span class="fa fa-times"></span>&nbsp;&nbsp;删 除
                                                    </a>
                                                    {neq name="$item.auding_status" value="2"}
                                                    <a href="{:url('update', ['id' => $item['id']])}"
                                                       class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;审 核
                                                    </a>
                                                    {else/}
                                                    <a
                                                            class="label label-warning">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;完 成
                                                    </a>
                                                    {/neq}
                                                    {/eq}
                                                    <a href="{:url('gift_card', ['gift_id' => $item['id'],'zcs' => $item['zcs'],'pages' =>1])}"
                                                       class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;会员卡
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                        <tbody align="left">
                                        <tr>
                                            <td colspan="17">
                                                <span>控制：</span>
                                                <a style="color:#428BCA"
                                                   href="javascript:UpOrderID('{:url(\'code\')}');">更新科目代码</a>
                                                <a style="color:#428BCA"
                                                   href="javascript:UpOrderID('{:url(\'sorting\')}');">更新排序</a>
                                                <a style="color:#428BCA"
                                                   href="javascript:UpOrderID('{:url(\'goods_sale\')}');">更新销量</a>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                <!-- 分页 -->
                                <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                <button type="button" class="btn btn-info" style="margin-top: 20px;" onclick="dc({:input('coupon_id')})">礼包导出</button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script type="text/javascript">

    // list

    $(document).ready(function () {

        // select2

        $(".select2_single").select2({
            placeholder: "请选择分类",
            allowClear: true

        });
        $('#interval_timer').daterangepicker(null,
            function(start, end, label) {
//                console.log(start.toISOString(), end.toISOString(), label);
            });
    });

    function dc(){
        var title = "{:input('title')}";
        var both = "{:input('interval_timer')}";
        window.location.href = "{:url('index')}?export=123&pa=10000&title="+title+"&interval_timer="+both;
    }

</script>